package com.fpd.model.entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.apache.commons.lang3.StringUtils;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fpd.model.vo.SysRoleVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 用户实体
 *
 * @author zhengzhibiao
 * @date 2019-08-22 17:36
 */
@Data
public class SysUser implements Serializable {

	private static final long serialVersionUID = 3739394131602100595L;

	@ApiModelProperty(value = "头像", example = "")
	private String headImg;

	@ApiModelProperty(value = "用户ID(新增不填)", example = "新增不填")
	private String userId;

	@ApiModelProperty(value = "登录名", example = "admin")
	private String username;

	@ApiModelProperty(value = "登录密码", example = "123456")
	private String password;

	@ApiModelProperty(value = "真实姓名", example = "admin")
	private String truename;

	@ApiModelProperty(value = "手机号", example = "13668221636")
	private String mobile;

	@ApiModelProperty(value = "手机号2", example = "13668221639")
	private String mobile2;

	@ApiModelProperty(value = "状态（0：离职；1：在职；2：休假中；3：其他）", example = "1")
	private Integer workState;

	@ApiModelProperty(value = "证件类型（0：身份证；1：护照号；2：驾照号；3：其他证件）", example = "0")
	private String idcardtype;

	@ApiModelProperty(value = "证件号", example = "4290041999102131250")
	private String idcard;

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	@ApiModelProperty(value = "最后一次登录时间", example = "")
	private Date lastLoginTime;

	@ApiModelProperty(value = "性别（0：男；1：女；2：保密）", example = "0")
	private Integer sex;

	@ApiModelProperty(value = "地址", example = "湖北省武汉市东西湖区常青花园五小区xx栋一单元1201号")
	private String address;

	@ApiModelProperty(value = "邮箱", example = "1134135987@qq.com")
	private String email;

	@ApiModelProperty(value = "微信号", example = "251522222")
	private String weixin;

	@ApiModelProperty(value = "QQ号", example = "100000021")
	private String qq;

	@ApiModelProperty(value = "所属分组ID", example = "0")
	private String groupId;

	@ApiModelProperty(value = "账号状态（0：未启用；1：启用）默认为1", example = "0")
	private Integer accountState;

	@ApiModelProperty(value = "是否超级管理员(0：不是、1：是)", example = "1")
	private Integer isSuper;

	@ApiModelProperty(value = "是否删除(0：未删除、1：已删除)", example = "0")
	private Integer isDelete;

	@ApiModelProperty(value = "是否分组（0：未分组；1：有分组）", example = "0")
	private Integer isGroup;

	@ApiModelProperty(value = "职位（1：管理员；2：数据管理员；3：项目经理；4：组长；5：平台客服；6：质检员）", hidden = true, example = "5")
	private Integer position;

	@ApiModelProperty(value = "角色集合")
	private List<SysRoleVO> roleList = new ArrayList<>();

	private String entrustId;

	private String entrustName;

	@ApiModelProperty(value = "客服工号", example = "")
	private String serviceJobnumber;

	@ApiModelProperty(value = "部门id", example = "00001")
	private String administratorId;
	
	private boolean canLeave;
	
	private boolean canNbLeave;
	
	private Integer sendCount; 
	
	public boolean isCanLeave() {
		if (StringUtils.isNotEmpty(this.entrustId) && !"6041ce3c3a70e12ee91478ef".equals(this.entrustId) && !"60124785f14c7184f2a31054".equals(this.entrustId)) {
			return true;
		}
		return false;
	}
	
	public boolean isCanNbLeave() {
		if (StringUtils.isNotEmpty(this.entrustId) && ("60124776f14c7184f2a31052".equals(this.entrustId) ||"6041ce3c3a70e12ee91478ef".equals(this.entrustId) || "60124785f14c7184f2a31054".equals(this.entrustId))) {
			return true;
		}
		return false;
	}

}
